import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 会员设置信息 */
export interface MembershipSettings {
          id: number; // 会员id
          membershipName?: string; // 会员名称
          price: number; // 价格
          underlinedPrice: number; // 划线价格
          consultationFrequency?: number; // 咨询次数(次数)
          registrationsFrequency?: number; // 报名次数(次数)
          lifeSpan?: number; // 有效期(天)
  }

// 会员设置 API
export const MembershipSettingsApi = {
  // 查询会员设置分页
  getMembershipSettingsPage: async (params: any) => {
    return await request.get({ url: `/biz/membership-settings/page`, params })
  },

  // 查询会员设置详情
  getMembershipSettings: async (id: number) => {
    return await request.get({ url: `/biz/membership-settings/get?id=` + id })
  },

  // 新增会员设置
  createMembershipSettings: async (data: MembershipSettings) => {
    return await request.post({ url: `/biz/membership-settings/create`, data })
  },

  // 修改会员设置
  updateMembershipSettings: async (data: MembershipSettings) => {
    return await request.put({ url: `/biz/membership-settings/update`, data })
  },

  // 删除会员设置
  deleteMembershipSettings: async (id: number) => {
    return await request.delete({ url: `/biz/membership-settings/delete?id=` + id })
  },

  /** 批量删除会员设置 */
  deleteMembershipSettingsList: async (ids: number[]) => {
    return await request.delete({ url: `/biz/membership-settings/delete-list?ids=${ids.join(',')}` })
  },

  // 导出会员设置 Excel
  exportMembershipSettings: async (params) => {
    return await request.download({ url: `/biz/membership-settings/export-excel`, params })
  },
}